class CreditCardController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'webhook' => ['post'],
],
],
];
}
public function beforeAction($action)
{
if ($action->id == 'webhook')
$this->enableCsrfValidation = false;
return parent::beforeAction($action);
}
public function actionWebhook()
{
$payload = file_get_contents('php://input');
ob_start();
var_dump($payload);
error_log(ob_get_clean(), 4);
echo json_encode(['status' => 'success']);
}